﻿package Classes.Enemies.Aero{
	import flash.events.Event;	
	import flash.display.Sprite;
	
	import Classes.Elements.*;
	import Classes.Utils.*;
	import Classes.Weapons.Rockets.*;
	import Classes.Weapons.*;
	import Classes.Weapons.Bullets.*;
	import Classes.Interface.*;
	
	public class Delta extends Aircraft{

		public function Delta(){
			super();
			speed = 3.5;
			life = 30;
			hp = 30;
			execution = 20;
			fireable = true;
			crtspeed = 0;
			accelerate = .5;
			condition = 0;
			weaponType = WeaponType.PhotonBullet;
			score = UnitType.Delta.score;
		}
		
		override protected function move():void{
			inc++;
			if(fireable)
				fire();
			hstate = this.x>(moverange[1]+moverange[0])/2?1:-1;
			var wave:Number = Math.sin(2*hstate*(this.y-condition)*Math.PI/180)*12;
			Moving.moveSlanting(this,speed,wave,condition);
			hitTest();
		}
		
		override public function fire():void{
			if(inc % weaponType.interval == 0){
				var photon:PhotonBullet = new PhotonBullet();
				photon.aTargets = this.aTargets;
				photon.sender = this;
				photon.x = this.x;
				photon.y = this.y;
				if(aTargets.length)
					Moving.pointTo(photon,aTargets[0])
				photon.angle = -photon.rotation;
				bulletLayer.addChild(photon);				
			}
		}
	}
}